<include file="Admin:header" />

<form method='post'  id="form1" action="{:U('Config/dosite')}">
<table width="100%"  cellpadding=0 cellspacing=0  class="table_form"> 
  <tr> 
    <th width="120">{:L('config_mail_md')}</th> 
    <td class="y-bg"> 
     <label><input name="mail_type" value="1" onclick="showsmtp()" type="radio"  <if condition="$mail_type == 1">  checked="checked"</if>> {:L('config_mail_smtp')}</label>   <label> <input name="mail_type" value="0" onclick="hidesmtp()" type="radio"  <if condition="$mail_type == 0">  checked="checked"</if> /> {:L('config_mail_mailfun')} </label>
	</td>
  </tr> 
  <tbody id="smtpconfig" style=""> 
  <tr> 
    <th>{:L('config_mail_server')}</th> 
    <td class="y-bg"><input type="text" class="input-text" name="mail_server" id="mail_server" size="30" value="{$mail_server}"/></td> 
  </tr>  
  <tr> 
    <th>{:L('config_mail_port')}</th> 
    <td class="y-bg"><input type="text" class="input-text" name="mail_port" id="mail_port" size="30" value="{$mail_port}"/></td> 
  </tr> 
  <tr> 
    <th>{:L('config_mail_from')}</th> 
    <td class="y-bg"><input type="text" class="input-text" name="mail_from" id="mail_from" size="30" value="{$mail_from}"/></td> 
  </tr>   
  <tr> 
    <th>{:L('config_mail_auth')}</th> 
    <td class="y-bg"> 
    <input name="mail_auth" id="mail_auth" value="1" type="radio" <if condition="$mail_auth == 1">  checked</if>> {:L('open_select')}	<input name="mail_auth" id="mail_auth" value="0" type="radio" <if condition="$mail_auth == 0">  checked</if> > {:L('close_select')}</td> 
  </tr> 
 
	  <tr> 
	    <th>{:L('config_mail_user')}</th> 
	    <td class="y-bg"><input type="text" class="input-text" name="mail_user" id="mail_user" size="30" value="{$mail_user}"/></td> 
	  </tr> 
	  <tr> 
	    <th>{:L('config_mail_password')}</th> 
	    <td class="y-bg"><input type="password" class="input-text" name="mail_password" id="mail_password" size="30" value="{$mail_password}"/></td> 
	  </tr> 
 
 </tbody> 
  <tr> 
    <th>{:L('config_mail_test')}</th> 
    <td class="y-bg"><input type="text" class="input-text" name="mail_to" id="mail_to" size="30" value=""/> <input type="button" class="button" onClick="javascript:test_mail();" value="{:L('config_mail_testsed')}"><span id="resinfo"></span></td> 
  </tr>     
  <tr> 
    <th>收件人地址</th> 
    <td class="y-bg"><input type="text" class="input-text" name="mail_consignee" id="mail_consignee" size="30" value="{$mail_consignee}"/></td> 
  </tr>
  <tr> 
    <th>库存提醒</th> 
    <td class="y-bg"><input type="checkbox" name="mail_alert" id="mail_alert" value="1" <if condition="$mail_alert == 1">  checked="checked"</if>/></td> 
  </tr>
  </table> 
<div class="btn">
<INPUT TYPE="submit"  value="{:L('save')}" class="button" >
<input TYPE="reset"  value="{:L('reset')}" class="button">
</div>{__TOKEN__}
</form>
</div>
<script>
function showsmtp(){
	$('#smtpconfig').show();
	$('input[name=mail_type]').val(1);
}
function hidesmtp(){
	$('#smtpconfig').hide();
	$('input[name=mail_type]').val(0);

}
function test_mail(){
//location.href = "{:U('Config/testmail')}";
$('#resinfo').html('正在发送测试邮件...');

 	var mail_type = $('input[name=mail_type]').val();
    $.post('{:U("Config/testmail")}&mail_to='+$('#mail_to').val(),{mail_type:mail_type,mail_server:$('#mail_server').val(),mail_port:$('#mail_port').val(),mail_user:$('#mail_user').val(),mail_password:$('#mail_password').val(),mail_auth:$('#mail_auth').val(),mail_auth:$('#mail_auth').val(),mail_from:$('#mail_from').val()}, function(data){
	$('#resinfo').html(data.info);
	},"json");

}
</script>